package com.doit.day01;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class _06_删除表 {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();
        //设置参数
        conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
        //创建连接对象
        Connection conn = ConnectionFactory.createConnection(conf);
        //获取连接对象
        Admin admin = conn.getAdmin();
        //因为创建表的描述器构建器需要一个表名TableName对象
        TableName tableName = TableName.valueOf("test:teacher");
        //禁用表
        admin.disableTable(tableName);
        //删除表，但是删除之前需要禁用表
        admin.deleteTable(tableName);




    }
}
